#include <iostream>
#include <cmath>
#include <cassert>
#include <ctime>
#include "../head/util.h"
#include "../head/binarySearch.h"

using namespace std;

// 循环不变量
int main(){
	
	long long n = pow(10,8);
	clock_t start = clock();
	long long* data = MyUtil::generateOrderedArray(n);
	clock_t end = clock();
	cout << double(end - start) / CLOCKS_PER_SEC << "s" << endl;	
	
	// logn 2.63s
	clock_t startTime = clock();
	binarySearch(data,n,1LL);
    // for(long long i = 0 ; i < n ; i ++)
       // assert(i == binarySearch(data, n, i));
    clock_t endTime = clock();

    cout << "Binary Search test complete." << endl;
    cout << "Time cost: " << double(endTime - startTime) / CLOCKS_PER_SEC 
		<< " s" << endl;
	return 0;
}
